/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entityprojet;

import java.io.Serializable;
import java.math.BigDecimal;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.JoinColumns;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author T.Ron
 */
@Entity
@Table(name = "BUDGETCGPB")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Budgetcgpb.findAll", query = "SELECT b FROM Budgetcgpb b"),
    @NamedQuery(name = "Budgetcgpb.findByIdCg", query = "SELECT b FROM Budgetcgpb b WHERE b.budgetcgpbPK.idCg = :idCg"),
    @NamedQuery(name = "Budgetcgpb.findByNumcg", query = "SELECT b FROM Budgetcgpb b WHERE b.numcg = :numcg"),
    @NamedQuery(name = "Budgetcgpb.findByComptepb", query = "SELECT b FROM Budgetcgpb b WHERE b.comptepb = :comptepb"),
    @NamedQuery(name = "Budgetcgpb.findByNumexo", query = "SELECT b FROM Budgetcgpb b WHERE b.budgetcgpbPK.numexo = :numexo"),
    @NamedQuery(name = "Budgetcgpb.findByMois", query = "SELECT b FROM Budgetcgpb b WHERE b.budgetcgpbPK.mois = :mois"),
    @NamedQuery(name = "Budgetcgpb.findByMontantdotfaiblecg", query = "SELECT b FROM Budgetcgpb b WHERE b.montantdotfaiblecg = :montantdotfaiblecg"),
    @NamedQuery(name = "Budgetcgpb.findByMontantdotfortecg", query = "SELECT b FROM Budgetcgpb b WHERE b.montantdotfortecg = :montantdotfortecg")})
public class Budgetcgpb implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected BudgetcgpbPK budgetcgpbPK;
    @Basic(optional = false)
    @Column(name = "NUMCG")
    private String numcg;
    @Basic(optional = false)
    @Column(name = "COMPTEPB")
    private String comptepb;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "MONTANTDOTFAIBLECG")
    private BigDecimal montantdotfaiblecg;
    @Column(name = "MONTANTDOTFORTECG")
    private BigDecimal montantdotfortecg;
    @JoinColumns({
        @JoinColumn(name = "NUMEXO", referencedColumnName = "NUMEXO", insertable = false, updatable = false),
        @JoinColumn(name = "MOIS", referencedColumnName = "MOIS", insertable = false, updatable = false)})
    @ManyToOne(optional = false)
    private Periode periode;
    @JoinColumn(name = "ID_CG", referencedColumnName = "ID_CG", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Compteg compteg;

    public Budgetcgpb() {
    }

    public Budgetcgpb(BudgetcgpbPK budgetcgpbPK) {
        this.budgetcgpbPK = budgetcgpbPK;
    }

    public Budgetcgpb(BudgetcgpbPK budgetcgpbPK, String numcg, String comptepb) {
        this.budgetcgpbPK = budgetcgpbPK;
        this.numcg = numcg;
        this.comptepb = comptepb;
    }

    public Budgetcgpb(int idCg, int numexo, int mois) {
        this.budgetcgpbPK = new BudgetcgpbPK(idCg, numexo, mois);
    }

    public BudgetcgpbPK getBudgetcgpbPK() {
        return budgetcgpbPK;
    }

    public void setBudgetcgpbPK(BudgetcgpbPK budgetcgpbPK) {
        this.budgetcgpbPK = budgetcgpbPK;
    }

    public String getNumcg() {
        return numcg;
    }

    public void setNumcg(String numcg) {
        this.numcg = numcg;
    }

    public String getComptepb() {
        return comptepb;
    }

    public void setComptepb(String comptepb) {
        this.comptepb = comptepb;
    }

    public BigDecimal getMontantdotfaiblecg() {
        return montantdotfaiblecg;
    }

    public void setMontantdotfaiblecg(BigDecimal montantdotfaiblecg) {
        this.montantdotfaiblecg = montantdotfaiblecg;
    }

    public BigDecimal getMontantdotfortecg() {
        return montantdotfortecg;
    }

    public void setMontantdotfortecg(BigDecimal montantdotfortecg) {
        this.montantdotfortecg = montantdotfortecg;
    }

    public Periode getPeriode() {
        return periode;
    }

    public void setPeriode(Periode periode) {
        this.periode = periode;
    }

    public Compteg getCompteg() {
        return compteg;
    }

    public void setCompteg(Compteg compteg) {
        this.compteg = compteg;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (budgetcgpbPK != null ? budgetcgpbPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Budgetcgpb)) {
            return false;
        }
        Budgetcgpb other = (Budgetcgpb) object;
        if ((this.budgetcgpbPK == null && other.budgetcgpbPK != null) || (this.budgetcgpbPK != null && !this.budgetcgpbPK.equals(other.budgetcgpbPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entityprojet.Budgetcgpb[ budgetcgpbPK=" + budgetcgpbPK + " ]";
    }
    
}
